package com.example.demo.entity;

import java.util.Date;

public class Like {
    private Long userId;         // 点赞者用户ID
    private Long postId;         // 帖子ID(可为空)
    private Long commentId;      // 评论ID(可为空)
    private Date createTime;     // 点赞时间

    // 构造方法
    public Like() {
    }

    public Like(Long userId, Long postId, Long commentId) {
        this.userId = userId;
        this.postId = postId;
        this.commentId = commentId;
        this.createTime = new Date();
    }

    // Getter和Setter方法
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public Long getCommentId() {
        return commentId;
    }

    public void setCommentId(Long commentId) {
        this.commentId = commentId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "Like{" +
                "userId=" + userId +
                ", postId=" + postId +
                ", commentId=" + commentId +
                ", createTime=" + createTime +
                '}';
    }
}